package reflection.dynamicproxy;


public class Client {
	public static void main(String[] args) {
		DynamicProxyTicketManager dynamicProxyTicketManager = new DynamicProxyTicketManager();
		TicketManager tm = (TicketManager) dynamicProxyTicketManager.newProxyInstance(new TicketManagerImpl());
		tm.soldTicket();
		tm.changeTicket();
		tm.returnTicket();
		System.out.println(tm.getClass().getName());//com.sun.proxy.$Proxy0
		
		System.out.println("*****************new start******************");
		
		CglibProxyTicketManager cglibProxyTicketManager = new CglibProxyTicketManager();
		//注意这里是类，不是接口
		TicketManagerImpl tm2 = (TicketManagerImpl) cglibProxyTicketManager.getProxy(TicketManagerImpl.class);
		tm2.soldTicket();
		tm2.changeTicket();
		tm2.returnTicket();
	}

}
